package com.black.pay.utils;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.Signature;
import java.util.Base64;

public class SignUtil {
    public static String md5(String data){
        try {
            MessageDigest messageDigest = MessageDigest.getInstance("md5");
            byte[] var1 = messageDigest.digest(data.getBytes());
            return encode(var1);
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return null;
    }

    public static String encode(byte[] data){
        String var1=Base64.getEncoder().encodeToString(data);
        return var1;
    }

    public static void main(String[] args) {
        System.out.println(md5("123"));;
    }
}
